package com.shen.langchain4j.controller;

import dev.langchain4j.model.chat.ChatModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 大模型控制层接口
 */

@Slf4j
@RestController
@RequestMapping(value = "/multiModel")
public class LangChain4JMultiModelController {
    @Autowired
    @Qualifier(value = "qwen")
    private ChatModel qwenModel;

    @Autowired
    @Qualifier(value = "deepseek")
    private ChatModel deepseekModel;

    @GetMapping(value = "/qwen/hello")
    public String qwenHelloModel(@RequestParam(value = "question", defaultValue = "你是谁") String question) {
        String result = qwenModel.chat(question);
        log.info("调用大模型结果为: {}", result);
        return result;
    }

    @GetMapping(value = "/deepseek/hello")
    public String deepseekHelloModel(@RequestParam(value = "question", defaultValue = "你是谁") String question) {
        String result = deepseekModel.chat(question);
        log.info("调用大模型结果为: {}", result);
        return result;
    }
}
